package com.stone.framework.workflow.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.stone.framework.core.mybatis.CommonEntityMetaObjectHandler;

@Configuration
public class MybatisConfig {

    /**
     * 分页插件
     * 
     * @return
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor interceptor = new PaginationInterceptor();
        return interceptor;
    }

    /**
     * 自动填充
     * 
     * @return
     */
    @Bean
    public CommonEntityMetaObjectHandler commonEntityMetaObjectHandler() {
        return new CommonEntityMetaObjectHandler();
    }

    /**
     * 乐观锁
     * 
     * @return
     */
    @Bean
    public OptimisticLockerInterceptor optimisticLockerInterceptor() {
        return new OptimisticLockerInterceptor();
    }

}
